package com.yami.shop.mystery.common.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yami.shop.bean.model.SkuStockLock;
import com.yami.shop.mystery.common.model.MysteryBoxOrder;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 盲盒盒子订单数据接口
 *
 * @author wxf
 * @date 2023/4/13 9:31
 */
public interface MysteryBoxOrderMapper extends BaseMapper<MysteryBoxOrder> {

    /**
     * 获取用户盲盒订单数量
     * @param boxId
     * @param activityId
     * @param userId
     * @return
     */
    Integer selectNumByUser(@Param("boxId") Long boxId, @Param("activityId") Long activityId, @Param("userId") String userId , @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    /**
     * 修改状态
     * @param orderNumber
     * @param state
     */
    void updateStateByOrderNumber(@Param("orderNumber") String orderNumber, @Param("state") int state);

    /**
     * 取消未支付
     * @param orderNumber
     */
    void cancelUnpayOrderByOrderNumber(@Param("orderNumber") String orderNumber);

    /**
     * 取消未支付订单
     */
    void cancelUnpayOrder();

    /**
     * 批量保存库存锁定信息
     *
     * @param mysteryBoxOrders 库存锁定信息
     */
    void saveBatch(@Param("mysteryBoxOrders") List<MysteryBoxOrder> mysteryBoxOrders);
}
